window.onload = function () {
    showOrder(1)
}

function showOrder(pageNO) {
    axios.get("/manager/order/findByItem",{
        params:{
            pageNO,
            status:$("status").value,
            startDate:$("startDate").value,
            endDate:$("endDate").value
        }
    }).then(e => {
        var info = e.data;
        var str = "";
        for (var i = 0;i < info.records.length;i++){
            var obj = info.records[i];
            str += `<tr>
                        <td>${obj.id}</td>
                        <td>${obj.totalPrice}</td>
                        <td>${obj.status}</td>
                        <td>${obj.orderDate}</td>
                        <td><a href="/manager/orderInfo.html?orderId=${obj.id}">查看订单</a></td>
                    </tr>`
        }

        $("bodyData").innerHTML = str;

        var cutStr = "";
        for (var i=1;i<=info.pages;i++){
            cutStr += `<a href="javascript:showOrder(${i})">${i}</a>`
        }
        $("cutPageDiv").innerHTML = cutStr;
    })
}